package ming.model.type;

import org.apache.commons.lang.StringUtils;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@SuppressWarnings("serial")
@Entity
@Table(name = "T_QUESTIONNAIRE_TABLES", catalog = "")
public class Tables implements java.io.Serializable {

	// Fields questionnaire

	private String id;
	private String question;
	private Integer seq;
	private Set<Tablesanswer> tablesanswers = new HashSet<Tablesanswer>(
			0);
	


	// Property accessors
	@Id
	@Column(name = "vcId", unique = true, nullable = false, length = 36)
	public String getId() {
		if (!StringUtils.isBlank(this.id)) {
			return this.id;
		}
		return UUID.randomUUID().toString();
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "vcQuestion", length = 500)
	public String getQuestion() {
		return this.question;
	}

	public void setQuestion(String question) {
		this.question = question;
	}

	@Column(name = "intSeq")
	public Integer getSeq() {
		return this.seq;
	}

	public void setSeq(Integer seq) {
		this.seq = seq;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "tables")
	public Set<Tablesanswer> getTablesanswers() {
		return this.tablesanswers;
	}

	public void setTablesanswers(Set<Tablesanswer> tablesanswers) {
		this.tablesanswers = tablesanswers;
	}

}